




 /**
  * 设置信息
  * @param {object} key 
  *  @param {object} value
  *  @param {object} iDay
  */

export const setCookie = (key, value, iDay) => {
    var oDate = new Date();
    oDate.setDate(oDate.getDate() + iDay);
    let cookie = document.cookie = key + '=' + value + ';expires=' + oDate;
    return cookie
}

/**
 * 获取信息
 * @returns {string}
 */
export const getCookie = (key) => {
    var cookieArr = document.cookie.split('; ');
    for (var i = 0; i < cookieArr.length; i++) {
        var arr = cookieArr[i].split('=');
        if (arr[0] === key) {
            return arr[1];
        }
    }
    return "";
}

export const removeCookie = (key) => {
    return setCookie(key, '', -1)
}